/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.service.api;

import info.peigen.hotpot.manage.core.service.order.RelationCreateOrder;
import info.peigen.hotpot.manage.core.service.result.RelationCreateResult;
import com.alibaba.fastjson2.JSON;
import info.peigen.hotpot.component.doc.core.annotation.Api;
import info.peigen.hotpot.component.open.api.facade.OpenApiServiceFacade;
import info.peigen.hotpot.component.open.api.facade.processor.base.OpenApiProcessorServiceContext;
import org.noear.solon.annotation.Component;

/**
 * <b>(RelationCreateApiService)</b>
 * "关联关系" 创建Api服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-06-28
 */
@SuppressWarnings({"rawtypes", "unchecked", "unused"})
@Api(name = "关联关系创建服务", code = "relationCreateApiService", order = RelationCreateOrder.class, result = RelationCreateResult.class)
@Component("relationCreateApiService")
public class RelationCreateApiService extends AbstractHotpotManageApiService implements OpenApiServiceFacade {
    @Override
    public void execute(OpenApiProcessorServiceContext serviceContext) {
        RelationCreateOrder  order  = JSON.parseObject(serviceContext.getApi().getDecrypt(), RelationCreateOrder.class);
        RelationCreateResult result = relationService.create(order);
        serviceContext.setResult(result);
    }
}